<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:composition template="/templates/principal.xhtml" >
<ui:define name="corpo" >
<p:growl id="mensagens" globalOnly="true" />
<p:panel header="Configurações" style="text-align: center; height: 30px; padding: 0px; font-size: 16px" /> 
    <p:tabView style="height: 430px; ">  
        <p:tab title="Processo">
            <h:form prependId="false" id="nup">
                <h:panelGroup>
                    <h:messages style="color: red" /> 
                    <h:panelGrid columns="2" cellspacing="2">
                        <h:outputLabel value="Seq.:" for="seqNup" />
                        <h:inputText  id="seqNup" label="Sequencial" value="#{configuracaoBean.seqNup}" size="6" maxlength="4" required="true" requiredMessage="Campo Seq. obrigatório!" >
                            <f:convertNumber integerOnly="true" minIntegerDigits="1" maxIntegerDigits="4" pattern="#" /> 
                           <f:validateLongRange minimum="1" maximum="9999" />  
                       </h:inputText>
                       <h:outputLabel value="Ano:" for="anonup" />
                       <h:inputText id="anonup" value="#{configuracaoBean.anoNup}" size="6" maxlength="4" required="true" requiredMessage="Campo Ano obrigatório!" >
                           <f:convertNumber integerOnly="true" minIntegerDigits="4" maxIntegerDigits="4" pattern="#" /> 
                           <f:validateLongRange minimum="2000" maximum="9999" />  
                       </h:inputText>
                       <h:outputLabel value="Sigla:" for="siglanup" />
                       <h:inputText id="siglanup" value="#{configuracaoBean.siglaNup}" size="15" maxlength="12" style="text-transform: uppercase;" required="true" requiredMessage="Campo Sigla obrigatório!" />
                       <br />
                       <h:outputLabel />
                       <p:commandButton action="#{configuracaoBean.salvarNup}" value="Salvar" update="nup, mensagens" image="ui-icon ui-icon-disk" disabled="#{configuracaoBean.habilitaBotaoSalvar}" />
                    </h:panelGrid>
                </h:panelGroup>
            </h:form>
        </p:tab>
        <p:tab title="Servidor Smtp"> 
            <h:form prependId="false" id="dadosServidorSmtp">
                <h:panelGroup>
                    <h:messages style="color: red" /> 
                    <h:panelGrid columns="2" cellspacing="2">
                        <h:outputLabel value="Remetente:" for="nomeremetente" />
                        <h:inputText id="nomeremetente" value="#{configuracaoBean.nomeRemetente}" size="60" maxlength="255"/>
                        <h:outputLabel value="Email remetente:" for="emailremetente" />
                        <h:inputText id="emailremetente" value="#{configuracaoBean.remetente}" size="60" maxlength="255" validatorMessage="E-mail remetente inválido!" >
                            <f:validateRegex pattern="[a-zA-Z0-9\-\_\.]+@[a-zA-Z0-9\-\_\.]+" />
                        </h:inputText>
                        <h:outputLabel value="Servidor Smtp:" for="servidorsmtp" />
                        <h:inputText id="servidorsmtp" value="#{configuracaoBean.servidorSmtp}" size="60" maxlength="255" />
                        <h:outputLabel value="Nome do usuário:" for="usuarioemail" />
                        <h:inputText id="usuarioemail" value="#{configuracaoBean.usuarioEmail}" size="60" maxlength="255" />
                        <h:outputLabel value="Senha email:" for="senhaemail" />
                        <h:inputSecret id="senhaemail" value="#{configuracaoBean.senhaEmail}" redisplay="true" maxlength="255" />
                        <h:outputLabel value="Porta:" for="portaservidor" />
                        <h:inputText id="portaservidor" value="#{configuracaoBean.porta}" size="4" maxlength="5" label="Campo Porta">
                            <f:convertNumber integerOnly="true" minIntegerDigits="1" pattern="#" /> 
                        </h:inputText>
                        <h:outputLabel value="SSL: " for="sslservidor" />
                        <h:selectBooleanCheckbox  id="sslservidor" value="#{configuracaoBean.ssl}" />
                        <h:outputLabel value="TLS: " for="tlsservidor" />
                        <h:selectBooleanCheckbox  id="tlsservidor" value="#{configuracaoBean.tls}" />
                        <br />
                        <h:outputLabel />
                        <p:commandButton action="#{configuracaoBean.salvarServidorSmtp}" value="Salvar" update="dadosServidorSmtp, mensagens" image="ui-icon ui-icon-disk" disabled="#{configuracaoBean.habilitaBotaoSalvar}" />
                    </h:panelGrid>
                </h:panelGroup>
            </h:form>
        </p:tab>
        <p:tab title="Termo de Responsabilidade">
            <h:form prependId="false" id="dadosTermo">
                <h:panelGroup>
                    <h:messages style="color: red" /> 
                    <h:panelGrid columns="1" cellspacing="2">
                        <h:outputLabel value="Termo:" for="termo" />
                        <h:inputTextarea id="termo" value="#{configuracaoBean.termo}" cols="81" rows="15" />
                        <p:commandButton action="#{configuracaoBean.salvarConfiguracaoTermo}" value="Salvar" update="dadosTermo, mensagens" image="ui-icon ui-icon-disk" disabled="#{configuracaoBean.habilitaBotaoSalvar}" />
                    </h:panelGrid>
                </h:panelGroup>
            </h:form>
        </p:tab>
        <p:tab title="Avisos">
            <h:form prependId="false" id="dadosAvisos">
                <h:panelGroup>
                    <h:messages style="color: red" /> 
                    <h:panelGrid columns="1" cellspacing="2">
                        <h:outputLabel value="Avisos:" for="avisos" />
                        <h:inputTextarea id="avisos" value="#{configuracaoBean.avisos}" cols="81" rows="15" />
                        <p:commandButton action="#{configuracaoBean.salvarConfiguracaoAvisos}" value="Salvar" update="dadosAvisos, mensagens" image="ui-icon ui-icon-disk" disabled="#{configuracaoBean.habilitaBotaoSalvar}" />
                    </h:panelGrid>
                </h:panelGroup>
            </h:form>
        </p:tab>
        <p:tab title="Dados da OM">
            <h:form prependId="false" id="dadosOM">
                <h:panelGroup>
                    <h:messages style="color: red" /> 
                    <h:panelGrid columns="2" cellspacing="2">
                        <h:outputLabel value="Nome OM" for="nomeOM" />
                        <h:inputText id="nomeOM" value="#{configuracaoBean.nomeOM}" size="60" maxlength="255" required="true" requiredMessage="Campo Nome OM obrigatório!" />
                        <h:outputLabel value="Sigla OM:" for="siglaOM" />
                        <h:inputText id="siglaOM" value="#{configuracaoBean.siglaOM}" size="20" maxlength="255" required="true" requiredMessage="Campo Sigla OM obrigatório!" />
                        <h:outputLabel value="Endereço OM:" for="enderecoOM" />
                        <h:inputText id="enderecoOM" value="#{configuracaoBean.enderecoOM}" size="60" maxlength="255" required="true" requiredMessage="Campo Endereço OM obrigatório!" />
                        <h:outputLabel value="Nome da seção de TI:" for="secaoTI" />
                        <h:inputText id="secaoTI" value="#{configuracaoBean.nomeSecaoTI}" size="60" maxlength="255" required="true" requiredMessage="Campo Nome da seção de TI obrigatório!" />
                        <h:outputLabel value="Telefone da Seção da TI:" for="telTI" />
                        <p:inputMask id="telTI" value="#{configuracaoBean.telTI}" size="12" maxlength="255" mask="(999)9999-9999" required="true" requiredMessage="Campo Telefone da Seção da TI obrigatório!" />
                        <h:outputLabel value="Nome da seção de transportes:" for="nomeSTS" />
                        <h:inputText id="nomeSTS" value="#{configuracaoBean.nomeSecaoSTS}" size="60" maxlength="255" required="true" requiredMessage="Campo Nome da seção de transportes obrigatório!" />
                        <h:outputLabel value="Endereço da seção de transportes:" for="enderecoSTS" />
                        <h:inputText id="enderecoSTS" value="#{configuracaoBean.enderecoSTS}" size="60" maxlength="255" required="true" requiredMessage="Campo Endereço da seção de transportes obrigatório!" />
                        <h:outputLabel value="Telefone da seção de transportes:" for="telSTS" />
                        <p:inputMask id="telSTS" value="#{configuracaoBean.telSTS}" size="12" maxlength="255" mask="(999)9999-9999" required="true" requiredMessage="Campo Telefone da seção de transportes obrigatório!" />
                        <br />
                        <h:outputLabel />
                        <p:commandButton action="#{configuracaoBean.salvarConfiguracaoOMSecao()}" value="Salvar" update="dadosOM, mensagens" image="ui-icon ui-icon-disk" disabled="#{configuracaoBean.habilitaBotaoSalvar}" />
                    </h:panelGrid>
                </h:panelGroup>
            </h:form>
        </p:tab> 
    </p:tabView>  
</ui:define>
</ui:composition>
</html>